package controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/url")
public class URLController {

    @RequestMapping("/f1")
    public void f1(){
        System.out.println("URLController.f1()");
    }

    @RequestMapping("/f2/*")
    public void f2(){
        System.out.println("URLController.f2()");
    }

    @RequestMapping("/f3/**")
    public void f3(){
        System.out.println("URLController.f3()");
    }

    @RequestMapping("/f4/?")
    public void f4(){
        System.out.println("URLController.f4()");
    }

    @RequestMapping("/f5/{id}")
    public void f5(@PathVariable("id") String id){
        System.out.println("URLController.f5()"+id);
    }

    @RequestMapping("/f6/{id}/{name}")
    public void f6(@PathVariable("id") String id,
                   @PathVariable("name") String name){
        System.out.println("URLController.f6()"+id+" "+name);
    }

    @RequestMapping("/f7{viewName}")
    public String f7(@PathVariable("viewName") String viewName){
        System.out.println("URLController.f7()");
        return viewName;
    }

    @RequestMapping("/f8/{id:\\d+}")
    public void f8(@PathVariable("id") String id){
        System.out.println("URLController.f8()"+id);
    }

    @RequestMapping({"/f9","/test9"})
    public void f9(){
        System.out.println("URLController.f9()");
    }

    @RequestMapping(value = "/f10",method = RequestMethod.POST)
    public void f10(){
        System.out.println("URLController.f10()");
    }

    @PostMapping("/f11")
    public void f11(){
        System.out.println("URLController.f11()");
    }

    @RequestMapping(value = "/f12",params = "name")
    public void f12(){
        System.out.println("URLController.f12()");
    }

    @RequestMapping(value = "/f13",params = "name=abc")
    public void f13(){
        System.out.println("URLController.f13()");
    }

    @RequestMapping(value = "/f14",params = "name!=abc")
    public void f14(){
        System.out.println("URLController.f14()");
    }

    @RequestMapping(value = "/f15",headers = "User-Agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0")
    public void f15(){
        System.out.println("URLController.f15()");
    }







}
